//
//  Shapes.m
//  DemoDrawingShapesInCanvasUsingObjects
//
//  Created by duc nguyen van on 8/15/11.
//  Copyright 2011 STU. All rights reserved.
//

#import "Shapes.h"

@implementation Shapes
@synthesize stroke;
@synthesize color;
@synthesize delegate;

- (id)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code.
    }
    return self;
}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
	UITouch *touch = [touches anyObject];
	BPoint = [touch locationInView:self];
	
	[delegate actionTouchesBegan:touches withEvent:event andView:self];
}

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
	
	UITouch *touch = [touches anyObject];
	EPoint = [touch locationInView:self];
	
	Vexter.x = EPoint.x - BPoint.x;
	Vexter.y = EPoint.y - BPoint.y;
	
	//NSLog(@"center this view is %f and %f", self.center.x , self.center.y);
//	NSLog(@"toches this view is %f and %f", newTouch.x , newTouch.y);
//	NSLog(@"vexter this view is %f and %f", Vexter.x , Vexter.y);
//	NSLog(@"---");

	[delegate actionTouchesMoved:touches withEvent:event andView:self andVexter:Vexter];
}
 
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code.
}
*/

- (void)dealloc {
    [super dealloc];
}


@end
